//接口数据显示jsonview   http://localhost:8080/api/look
// const router = require("koa-router")();

const Router = require("koa-router")
const router = new Router();
// console.log(router instanceof Router);//config/index.js  requireDirectory
const MembersModel = require("../../models/Members")
// 查询数据库
router.post("/api/delete",async ctx=>{
    // ctx.body = "api"
    var {id} = ctx.request.body;
    console.log(id)
    try{
        await MembersModel.deleteOne({_id:id})
        ctx.body = {
            code:200,
            msr:"删除成功"
        }
    }catch(err){
        console.log(err);
        ctx.body = {
            code:400,
            msg:"请求的参数错误",
            request:"POST /api/delete"
        }
    }
})
module.exports = router;